/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK - core/memory
// Copyright( c) 2014.  All Rights Reserved
//
// File:		AEProperty.inl
// Author:		Gianluca Belardelli
// Date:		07/05/2014
//
/////////////////////////////////////////////////////////////////////////
#ifndef _AEPROPERTY_INL_
#define _AEPROPERTY_INL_

AE_FORCEINLINE AEProperty::AEProperty( void )
{
	m_szName[0] = '\0';
	m_lpData = 0L;
	m_uiFlags = AEPF_DEFAULT;
}

AE_FORCEINLINE AEProperty::~AEProperty( void )
{
}

template <typename T>
AE_FORCEINLINE T &AEProperty::GetValue( void )
{
	return *(static_cast<T*>( m_lpData ));
}

template <>
AE_FORCEINLINE int &AEProperty::GetValue( void )
{
	return m_uPropValues.nValue;
}

template <typename T>
AE_FORCEINLINE void AEProperty::SetValue( const T &tValue )
{
	AEASSERT_MSG( m_szName[0] != '\0', "SetValue su una property senza nome" );
	AEASSERT_MSG( m_lpData != 0L, "SetValue su una property non bindata" );
	m_lpData = tValue;
}

template <>
AE_FORCEINLINE void AEProperty::SetValue<int>( const int &tValue )
{
	AEASSERT_MSG( m_szName[0] != '\0', "SetValue su una property senza nome" );
	m_uPropValues.nValue = tValue;
}

template <>
AE_FORCEINLINE void AEProperty::SetValue<float>( const float &tValue )
{
	AEASSERT_MSG( m_szName[0] != '\0', "SetValue su una property senza nome" );
	m_uPropValues.fValue = tValue;
}

AE_FORCEINLINE void AEProperty::SetName( const char *lpPropName )
{
	AEASSERT_MSG( m_szName[0] == '\0', "Bind su una property inizializzata" );
	strncpy( m_szName, lpPropName, MAX_PROPNAME_LEN );
	m_uiFlags |= AEPF_TEMP;
}

template <typename T>
AE_FORCEINLINE void AEProperty::Bind( const char *lpName, T *tVar )
{
	AEASSERT_MSG( m_szName[0] == '\0', "Bind su una property inizializzata" );

	strncpy( m_szName, lpName, MAX_PROPNAME_LEN );
	m_lpData = tVar;
}

AE_FORCEINLINE const char *AEProperty::GetName( void )
{
	return m_szName;
}

/*
AE_FORCEINLINE AEProperty::AEProperty( void ) : m_pfFlags( AEPF_INVALID ), m_lpDescr( 0L )
{
}

AE_FORCEINLINE void AEProperty::Initialize( const char *lpName, AEPropertyTypes ptType, AEPropertyFlags pfFlags, const char *lpDescr )
{
	strncpy( m_szName, lpName, MAX_PROPNAME_LEN );
	m_ptType = ptType;
	m_pfFlags = pfFlags;

	if( lpDescr )
	{
		const AEINT32 nLen = strlen( lpDescr );
		m_lpDescr = new char[ nLen + 1 ];
		strncpy( m_lpDescr, lpDescr, nLen );
	}
}

AE_FORCEINLINE const char *AEProperty::GetName( void )
{
	return m_szName;
}

AE_FORCEINLINE AEProperty::AEPropertyTypes AEProperty::GetType( void )
{
	return m_ptType;
}

AE_FORCEINLINE AEProperty::AEPropertyFlags AEProperty::GetFlags( void )
{
	return m_pfFlags;
}

AE_FORCEINLINE void AEProperty::SetFlags( AEPropertyFlags pfFlags )
{
	m_pfFlags = pfFlags;
}

AE_FORCEINLINE void AEProperty::ClearFlags( void )
{
	m_pfFlags = AEPF_INVALID;
}


*/

#endif // _AEPROPERTY_INL_
